﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ShopPowerTemplate.Common.Validation
{
	public class DateTimeValidationControl
    {
        public static ObservableCollection<string> AddDayList(int days)
        {
            ObservableCollection<string> dayList = new ObservableCollection<string>();
            for (int i = 1; i <= days; i++)
                dayList.Add(i.ToString());

            return dayList;
        }

        public static ObservableCollection<string> AddMonthList()
        {
            ObservableCollection<string> monthList = new ObservableCollection<string>();
            DateTimeFormatInfo mfi = new DateTimeFormatInfo();
            for (int i = 1; i <= 12; i++)
                monthList.Add(mfi.GetMonthName(i).ToString());

            return monthList;
        }

        public static ObservableCollection<string> AddYearList(int year)
        {
            ObservableCollection<string> yearList = new ObservableCollection<string>();
            for (int i = year; i <= (year + 15); i++)
                yearList.Add(i.ToString());

            return yearList;
        }

        public static ObservableCollection<string> AddYearBirthDateList(int year)
        {
            ObservableCollection<string> yearList = new ObservableCollection<string>();
            int aux = year-80;
            for (int i = aux; i <= year; i++)
                yearList.Add(i.ToString());

            return yearList;
        }

        public static ObservableCollection<string> ValidationDays(int year, int month)
        {
            int days = DateTime.DaysInMonth(year, month);
            return AddDayList(days);
        }
    }
}